package demo;

public class Computer {
    public void open() {
        System.out.println("开机！");
    }
    public void close() {
        System.out.println("关机！");
    }

    public void useService(IUSB usb) {
        usb.openService();
        if (usb instanceof Mouse) {
            Mouse mouse = (Mouse) usb;
             mouse.Click();
        }else if (usb instanceof KeyBoard) {
            KeyBoard keyBoard = (KeyBoard) usb;
            keyBoard.input();
        }
        usb.closeService();
    }
}
